import React,{useEffect} from 'react'
import * as echarts from 'echarts'

export default function ChartBar(props) {
  const {optionsData = null, id = 'default-id', width = 600, height = 200,seriesName} = props;
 
  useEffect(() => {
    //初始化echarts
    var myChart = echarts.init(document.getElementById(id))
    var options={
      series:[
        {
          type:'pie',
          data:optionsData,
          label:{
            show:true,
            formatter:function(arg){
              return arg.name+'的招生量是'+arg.value+'个\n'+arg.percent+'%'
            }
          },
          // radius:['20%','80%']
          // roseType:'radius',
           selectedMode:'single'
        }
      ]
    }
    myChart.setOption(options);
  })
  return (
    <div id={id} style={{width: width, height: height}}>222</div>
  )
}
